/**
  * @file Storage.h
  * @author Przemyslaw Plutecki
**/
#pragma once
#ifndef STORAGE_H_
#define STORAGE_H_
#include <boost/noncopyable.hpp>
#include <boost/serialization/access.hpp>
#include "SeriesStorage.h"
#include "ChartsStorage.h"
// singleton
namespace LightChart {
/**
        @class Storage
        @author Maciej Siczek, Przemyslaw Plutecki
        @version 1.0
        @brief Storage holds all program data, provided by user. Also, supports serialization.

        @see ChartsStorage, SeriesStorage
    */
class Storage: public boost::noncopyable {
public:
    static Storage & get_instance() { ///< returns singleton's instance @return static Storage & storage instance
        return s;
    }
    SeriesStorage series;
    ChartsStorage charts;
private:
    static Storage s;
    Storage() {}
    friend class boost::serialization::access;
    template<class Archive> void serialize(Archive & ar, const unsigned int version);
};
template <class Archive> inline void Storage::serialize(Archive & ar, const unsigned int) {
    ar & series;
#if BOOST_VERSION > 104200
#else
    ar & charts;
#endif
}
} /* namespace LightChart */
#endif /* STORAGE_H_ */
